﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiWorldDraw : OdGiCommonDraw
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiWorldDraw(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiWorldDraw_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiWorldDraw obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiWorldDraw()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiWorldDraw(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public OdGiWorldDraw() : this(GlobalsPINVOKE.new_OdGiWorldDraw(), MemoryManager.GetMemoryManager().GetCurrentTransaction() == null)
		{
			MemoryTransaction currentTransaction = MemoryManager.GetMemoryManager().GetCurrentTransaction();
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdGiWorldDraw(this.swigCPtr.Handle, true));
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		public new static OdGiWorldDraw cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiWorldDraw_cast(OdRxObject.getCPtr(pObj));
			OdGiWorldDraw result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiWorldDraw_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("isA", OdGiWorldDraw.swigMethodTypes1) ? GlobalsPINVOKE.OdGiWorldDraw_isASwigExplicitOdGiWorldDraw(this.swigCPtr) : GlobalsPINVOKE.OdGiWorldDraw_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(this.SwigDerivedClassHasMethod("queryX", OdGiWorldDraw.swigMethodTypes0) ? GlobalsPINVOKE.OdGiWorldDraw_queryXSwigExplicitOdGiWorldDraw(this.swigCPtr, OdRxClass.getCPtr(protocolClass)) : GlobalsPINVOKE.OdGiWorldDraw_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdGiWorldDraw createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiWorldDraw_createObject();
			OdGiWorldDraw result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiWorldDraw)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiWorldGeometry geometry()
		{
			OdGiWorldGeometry result = (OdGiWorldGeometry)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiWorldDraw_geometry(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("queryX", OdGiWorldDraw.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_0(this.SwigDirectorqueryX);
			}
			if (this.SwigDerivedClassHasMethod("isA", OdGiWorldDraw.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_1(this.SwigDirectorisA);
			}
			if (this.SwigDerivedClassHasMethod("regenType", OdGiWorldDraw.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_2(this.SwigDirectorregenType);
			}
			if (this.SwigDerivedClassHasMethod("regenAbort", OdGiWorldDraw.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_3(this.SwigDirectorregenAbort);
			}
			if (this.SwigDerivedClassHasMethod("subEntityTraits", OdGiWorldDraw.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_4(this.SwigDirectorsubEntityTraits);
			}
			if (this.SwigDerivedClassHasMethod("rawGeometry", OdGiWorldDraw.swigMethodTypes5))
			{
				this.swigDelegate5 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_5(this.SwigDirectorrawGeometry);
			}
			if (this.SwigDerivedClassHasMethod("isDragging", OdGiWorldDraw.swigMethodTypes6))
			{
				this.swigDelegate6 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_6(this.SwigDirectorisDragging);
			}
			if (this.SwigDerivedClassHasMethod("deviation", OdGiWorldDraw.swigMethodTypes7))
			{
				this.swigDelegate7 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_7(this.SwigDirectordeviation);
			}
			if (this.SwigDerivedClassHasMethod("numberOfIsolines", OdGiWorldDraw.swigMethodTypes8))
			{
				this.swigDelegate8 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_8(this.SwigDirectornumberOfIsolines);
			}
			if (this.SwigDerivedClassHasMethod("context", OdGiWorldDraw.swigMethodTypes9))
			{
				this.swigDelegate9 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_9(this.SwigDirectorcontext);
			}
			if (this.SwigDerivedClassHasMethod("currentGiPath", OdGiWorldDraw.swigMethodTypes10))
			{
				this.swigDelegate10 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_10(this.SwigDirectorcurrentGiPath);
			}
			if (this.SwigDerivedClassHasMethod("geometry", OdGiWorldDraw.swigMethodTypes11))
			{
				this.swigDelegate11 = new OdGiWorldDraw.SwigDelegateOdGiWorldDraw_11(this.SwigDirectorgeometry);
			}
			GlobalsPINVOKE.OdGiWorldDraw_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4, this.swigDelegate5, this.swigDelegate6, this.swigDelegate7, this.swigDelegate8, this.swigDelegate9, this.swigDelegate10, this.swigDelegate11);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdGiWorldDraw));
		}

		private IntPtr SwigDirectorqueryX(IntPtr protocolClass)
		{
			return OdRxObject.getCPtr(this.queryX((OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(protocolClass, false))).Handle;
		}

		private IntPtr SwigDirectorisA()
		{
			return OdRxClass.getCPtr(this.isA()).Handle;
		}

		private int SwigDirectorregenType()
		{
			return (int)this.regenType();
		}

		private bool SwigDirectorregenAbort()
		{
			return this.regenAbort();
		}

		private IntPtr SwigDirectorsubEntityTraits()
		{
			return OdGiSubEntityTraits.getCPtr(this.subEntityTraits()).Handle;
		}

		private IntPtr SwigDirectorrawGeometry()
		{
			return OdGiGeometry.getCPtr(this.rawGeometry()).Handle;
		}

		private bool SwigDirectorisDragging()
		{
			return this.isDragging();
		}

		private double SwigDirectordeviation(int deviationType, IntPtr pointOnCurve)
		{
			return this.deviation((OdGiDeviationType)deviationType, new OdGePoint3d(pointOnCurve, false));
		}

		private uint SwigDirectornumberOfIsolines()
		{
			return this.numberOfIsolines();
		}

		private IntPtr SwigDirectorcontext()
		{
			return OdGiContext.getCPtr(this.context()).Handle;
		}

		private IntPtr SwigDirectorcurrentGiPath()
		{
			return OdGiPathNode.getCPtr(this.currentGiPath()).Handle;
		}

		private IntPtr SwigDirectorgeometry()
		{
			return OdGiWorldGeometry.getCPtr(this.geometry()).Handle;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_0 swigDelegate0;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_1 swigDelegate1;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_2 swigDelegate2;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_3 swigDelegate3;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_4 swigDelegate4;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_5 swigDelegate5;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_6 swigDelegate6;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_7 swigDelegate7;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_8 swigDelegate8;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_9 swigDelegate9;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_10 swigDelegate10;

		private OdGiWorldDraw.SwigDelegateOdGiWorldDraw_11 swigDelegate11;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(OdRxClass)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[0];

		private static Type[] swigMethodTypes3 = new Type[0];

		private static Type[] swigMethodTypes4 = new Type[0];

		private static Type[] swigMethodTypes5 = new Type[0];

		private static Type[] swigMethodTypes6 = new Type[0];

		private static Type[] swigMethodTypes7 = new Type[]
		{
			typeof(OdGiDeviationType),
			typeof(OdGePoint3d)
		};

		private static Type[] swigMethodTypes8 = new Type[0];

		private static Type[] swigMethodTypes9 = new Type[0];

		private static Type[] swigMethodTypes10 = new Type[0];

		private static Type[] swigMethodTypes11 = new Type[0];

		public delegate IntPtr SwigDelegateOdGiWorldDraw_0(IntPtr protocolClass);

		public delegate IntPtr SwigDelegateOdGiWorldDraw_1();

		public delegate int SwigDelegateOdGiWorldDraw_2();

		public delegate bool SwigDelegateOdGiWorldDraw_3();

		public delegate IntPtr SwigDelegateOdGiWorldDraw_4();

		public delegate IntPtr SwigDelegateOdGiWorldDraw_5();

		public delegate bool SwigDelegateOdGiWorldDraw_6();

		public delegate double SwigDelegateOdGiWorldDraw_7(int deviationType, IntPtr pointOnCurve);

		public delegate uint SwigDelegateOdGiWorldDraw_8();

		public delegate IntPtr SwigDelegateOdGiWorldDraw_9();

		public delegate IntPtr SwigDelegateOdGiWorldDraw_10();

		public delegate IntPtr SwigDelegateOdGiWorldDraw_11();
	}
}
